#include "sCIButton.h"
#include "sComponentButton.h"
#include "sActionHandlerPress.h"
#include "sGUI.h"

namespace sgui
{
namespace inst
{

sComponentInstanceButton::sComponentInstanceButton(sGUI& gui, const res::sComponentObject& object, sComponentInstance* parent) :
	sComponentInstanceLabel(gui, object, parent)
{

}
   
void sComponentInstanceButton::OnEventPressed()
{
    //
}
   
bool sComponentInstanceButton::OnHandlerEvent(const sActionHandlerEvent& event)
{
    switch (event.getID())
    {
        case EAEID_PRESS:
        {
            OnEventPressed();
            return true;
        }
    }
    return false;
}
    
bool sComponentInstanceButton::OnPress(const obs::sMousePressEvent& event, sComponentRectInstance* rect)
{
    switch (rect->getID())
    {
        case res::sComponentButton::REQUIRED_RECT_TEXT_TOUCH_ZONE:
        {
            getGui().setHandler(new sActionHandlerPress(this, rect), &event);
            return true;
        }
    }

    return false;
}

sComponentInstanceButton::~sComponentInstanceButton()
{
	//
}

};
};